package com.one.rope.mvp.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import java.util.Properties;

/**
 * @author Weijian.liu
 * @desc Shiro权限异常配置
 * @date 2018/12/18
 */
@Configuration
public class ShiroExceptionConfig {

  @Bean
  public SimpleMappingExceptionResolver resolver() {
    SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();
    Properties properties = new Properties();
    properties.setProperty("org.apache.shiro.authz.UnauthorizedException", "/403");
    resolver.setExceptionMappings(properties);
    return resolver;
  }

}
